#include "ThreadPool.hpp"
#include "Task.hpp"
#include "Log.hpp"
#include <iostream>
#include <string>
#include <memory>
#include <ctime>
#include <signal.h>



#if 1
void handler(int signo)
{
    LOG(DEBUG, "接收到信号");
    ThreadPool<Task>::GetInstance()->Stop();
}

int main()
{
    signal(SIGINT, handler);

    LOG(DEBUG, "程序已经加载");
    sleep(3);
    ThreadPool<Task>* tp = ThreadPool<Task>::GetInstance();


    int tasknum = 100;
    for(int i = 1; i < tasknum; i++)
    {
        tp->Enqueue(Task(i, i));
    }

    tp->Wait();
    sleep(2);

    return 0;
}
#endif